diff options
| author | Adam Soltys <[email protected]> | 2025-07-19 17:59:56 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-07-19 18:07:57 -0700 |
| commit | d87ecae6ee46af4790e1f57cd5d82a35ab29e646 (patch) | |
| tree | 5fa86b7b8902315f625eca493861f3ad97de5a5c /src/routes/(app)/invoice/[id]/tip | |
| parent | fea147df07046f240e77075e7c743959d85b1271 (diff) | |
| download | coinos-ui-d87ecae6ee46af4790e1f57cd5d82a35ab29e646.tar.gz coinos-ui-d87ecae6ee46af4790e1f57cd5d82a35ab29e646.zip | |
prompt for tip for auto pays
Diffstat (limited to 'src/routes/(app)/invoice/[id]/tip')
| -rw-r--r-- | src/routes/(app)/invoice/[id]/tip/+page.server.ts | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/routes/(app)/invoice/[id]/tip/+page.server.ts b/src/routes/(app)/invoice/[id]/tip/+page.server.ts index 988b6da5..12582b28 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.server.ts +++ b/src/routes/(app)/invoice/[id]/tip/+page.server.ts @@ -5,23 +5,14 @@ import { fail, redirect } from "@sveltejs/kit"; export async function load({ cookies, parent }) { const rates = await getRates(); - let { invoice, subject, user } = await parent(); + const { invoice, subject, user } = await parent(); if (!invoice.amount) redirect(307, `/invoice/${invoice.id}`); const pin = cookies.get("pin"); if (user) { const trust = await get("/trust", auth(cookies)); const trusted = trust.includes(invoice.uid); - if (trusted && (pin || !user.haspin)) { - if (!invoice.prompt && invoice.user.prompt && user.tip > 0) { - invoice.tip = Math.round(invoice.amount * (user.tip / 100)); - invoice = await post( - "/invoice", - { invoice, user: subject }, - auth(cookies), - ); - } - + if (trusted && (pin || !user.haspin) && user.tip > 0) { let p; try { p = await post("/payments", { ...invoice, pin }, auth(cookies)); |
